<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model backend\models\UserConsumption */

$this->title                   = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'User Consumptions', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-consumption-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <?= DetailView::widget([
        'model'      => $model,
        'attributes' => [
            'id',
            [
                'attribute' => 'uid',
                'label'     => '用户',
                'value'     => function ($model) {
                    return $model->u->username;
                }

            ],
            [
                'attribute' => 'order_id',
                'label'     => '订单号',
                'value'     => function ($model) {
                    return $model->order->order_id;
                }
            ],
            'money',
            [
                'attribute' => 'type',
                'filter'    => \common\libs\Constants::getUserConsumptionType(),
                'value'     => function ($model) {
                    return \common\libs\Constants::getUserConsumptionType($model->type);
                }
            ],
            'created_at:datetime',
        ],
    ]) ?>

</div>
